﻿
module("Vector2D.init")
test("When vector is initialized, should set the correct values", function () {
    var x = 10;
    var y = 5;
    var vect2D = new tetris.Vector2D(x, y);

    deepEqual(x, vect2D.x, "X is set");
    deepEqual(y, vect2D.y, "Y is set");
});

test("Length of vector", function () {
    var x = 3;
    var y = 4;
    var vect2D = new tetris.Vector2D(x, y);
    var vectLength = vect2D.length();

    equal(5.00, vectLength, "Length is set");
});

test("Addition of vectors", function () {
    var x = 3;
    var y = 4;
    var vect2D = new tetris.Vector2D(x, y);
    var vect2Dsecond = new tetris.Vector2D(5, 6);
    var vect2DResult = vect2D.plus(vect2Dsecond);

    equal(8, vect2DResult.x, "X coordinate is correct");
    equal(10, vect2DResult.y, "Y coordinate is correct");
});


module("Block.init")
test("Block init", function () {
    var x = 1;
    var y = 0;
    var color="#FF0000";
    
    var block = new tetris.Block(x, y, color);
    equal(x, block.coordinate.x, "X is set");
    equal(y, block.coordinate.y, "Y is set");
    equal(color, block.color, "Color is set");
});